Difference Between Layers and Tiers
Layer と Tier、どちらも日本語だと『層』と訳されるが、これらは異なる概念である
https://www.baeldung.com/cs/layers-vs-tiers
Layers
The term layer refers to a logical separation of code. In other words, it’s a coherent set of related functionality.
Structuring applications in layers is a way to organize our codebase better. For this reason, portability and maintainability are drivers that push us to use this kind of structure.
Indeed, we find an application of this concept in various types of architecture, such as Layered Architecture and Hexagonal Architecture.
As an example, the following is a representation of a layered architecture:
コードの論理的な分離を意味する(物理的な分離は関係ない)
アプリケーションを Layer で構造化するということは、コードベース をよりよく整理することを指す。
実際、レイヤードアーキテクチャ や ヘキサゴナルアーキテクチャ など、様々なアーキテクチャに Layer の概念が応用されている。
e.g. レイヤードアーキテクチャ
https://www.baeldung.com/wp-content/uploads/sites/4/2021/04/Layered-Architecture-2.png
UI レイヤー、ビジネスロジックレイヤー、データアクセスレイヤーはそれぞれ異なる責務を持ち、論理的に分離されている
Tier
On the other hand, the term tier refers to the physical structure. Tiers define where to deploy the layers, without necessarily a one-to-one mapping. So when we talk of an application’s tiers, we mean its topology.
コードの物理的な構造を表す
Tier は Layer をどこに配置するかを定義する
アプリケーションが実行される コンピューティング 環境を考慮して定義する
必ずしも 1 to 1 で対応する必要はない
同じアーキテクチャの構成要素であっても、異なるサーバに配置して別々にデプロイすることも可能
e.g. レイヤードアーキテクチャ + 2層アーキテクチャ
https://www.baeldung.com/wp-content/uploads/sites/4/2021/04/Tier-Architecture-2.png
アプリケーションを Tier で分割することで、より高い スケーラビリティ を実現できる
e.g. レイヤードアーキテクチャ + 3層アーキテクチャ(多層アーキテクチャ)
https://www.baeldung.com/wp-content/uploads/sites/4/2021/04/Tier-Architecture.png